package GUI.XML;

import TDAMapeo.Entrada;
import TDAPila.EmptyStackException;

public class XMLWriterTester {
    @SuppressWarnings("unchecked")
	public static void main(String[] args) {
        try {
            XMLWriter xmlw = new XMLWriter(false);
            xmlw.openSection("tree");
                xmlw.openSection("declarations");
                    Entrada<String, String>[] decls = new Entrada[2];
                    decls[0] = new Entrada<String, String>("name", "name");
                    decls[1] = new Entrada<String, String>("type", "String");
                    xmlw.autoCloseSection("attributeDecl", decls);
                xmlw.closeLastOpenedSection();
                xmlw.openSection("branch");
                    decls[1] = new Entrada<String, String>("value", "raiz");
                    xmlw.autoCloseSection("attribute", decls);
                    xmlw.openSection("branch");
                        decls[1].setValue("h1");
                        xmlw.autoCloseSection("attribute", decls);
                        xmlw.openSection("leaf");
                            xmlw.autoCloseSection("attribute", decls);
            System.out.println(xmlw.getXMLString());
        } catch (EmptyStackException ex) {
            //ni en p*** se llega a esto :P
        }
    }
}
